Skip to content

RANGER-5718: Add gson to PDP server lib classpath - #1122

Merged
ramackri merged 1 commit into
apache:masterfrom
ramackri:RANGER-5718
Aug 1, 2026
Merged

ramackri merged 1 commit into
apache:masterfrom
ramackri:RANGER-5718

Conversation

@ramackri

@ramackri ramackri commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes NoClassDefFoundError: com/google/gson/GsonBuilder logged by the Ranger PDP server on every plugin initialization when policies/tags are downloaded from Admin.

The PDP assembly descriptor (distro/src/main/assembly/pdp.xml) uses a strict lib/ dependency whitelist but did not include gson, unlike other Ranger plugin assemblies (KMS, Kafka, Solr, etc.). As a result, ranger-2.9.0-pdp.tar.gz and the ranger-pdp docker image ship without gson-*.jar on the classpath.

Policy download and authorization still work today because RangerAdminRESTClient parses Admin REST responses with Jackson. The error is non-fatal (AbstractRangerAdminClient.init() catches it and leaves gson null) but is noisy and leaves file-based policy sources (EmbeddedResourcePolicySource, LocalFolderPolicySource) without Gson support.

Changes

  • distro/src/main/assembly/pdp.xml: add com.google.code.gson:gson:jar:${gson.version} to the binaries whitelist
  • pdp/pom.xml: declare explicit gson runtime dependency

Test plan

  • Built PDP modules with the change (mvn install -pl pdp,... -am)
  • Assembly descriptor resolves gson to gson-2.9.0
  • Docker smoke test on existing rangernw stack (isolated PDP on port 16500):
    • With gson-2.9.0.jar in lib/: health READY, POST /authz/v1/authorize → ALLOW, PolicyRefresher downloads policies, no GsonBuilder ERROR
    • Without gson (pre-fix): same NoClassDefFoundError reproduced
  • CI green
  • After merge: rebuild ranger-*-pdp.tar.gz and verify tar -tzf ... | grep gson

Jira

https://issues.apache.org/jira/browse/RANGER-5718

Made with Cursor

Package gson in the ranger-pdp tarball and declare it as a PDP dependency
so AbstractRangerAdminClient can initialize GsonBuilder without
NoClassDefFoundError on plugin startup.

https: //issues.apache.org/jira/browse/RANGER-5718
Co-authored-by: Cursor <cursoragent@cursor.com>
@ramackri
ramackri requested a review from mneethiraj August 1, 2026 04:16
@ramackri
ramackri merged commit e8afc18 into apache:master Aug 1, 2026
4 checks passed
ramackri pushed a commit that referenced this pull request Aug 1, 2026
Package gson in the ranger-pdp tarball and declare it as a PDP dependency
so AbstractRangerAdminClient can initialize GsonBuilder without
NoClassDefFoundError on plugin startup.

Backport of e8afc18 (#1122) from master.

https://issues.apache.org/jira/browse/RANGER-5718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants